package cn.cljh.day9_19.pojo;

import java.util.Objects;

public class Book {
    private int id;
    private String code;
    private String name;
    private int total;
    private int lendNum;

    public Book() {
    }

    public Book(String code, String name, int total, int lendNum) {
        this.code = code;
        this.name = name;
        this.total = total;
        this.lendNum = lendNum;
    }

    public Book(int id, String code, String name, int total, int lendNum) {
        this.id = id;
        this.code = code;
        this.name = name;
        this.total = total;
        this.lendNum = lendNum;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getLendNum() {
        return lendNum;
    }

    public void setLendNum(int lendNum) {
        this.lendNum = lendNum;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Book)) return false;
        Book book = (Book) o;
        return getId() == book.getId() && getTotal() == book.getTotal() && getLendNum() == book.getLendNum() && Objects.equals(getCode(), book.getCode()) && Objects.equals(getName(), book.getName());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getCode(), getName(), getTotal(), getLendNum());
    }

    @Override
    public String toString() {
        return id+"\t"+code+"\t"+name+"\t"+total+"\t"+lendNum;
    }
}
